package com.demo.dao.impl;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.demo.biz.UserBiz;
import com.demo.dao.UserDao;
import com.demo.entity.User;

public class Test {
	public static void main(String[] args) {
		//加载spring配置文件，构建在配置文件中声明的对象
		ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
		//从容器中获取对象
		
		/*UserDao userDao=(UserDao) context.getBean("userDao");
		System.out.println(userDao.query());*/
		
		/*UserBiz userBiz=(UserBiz)context.getBean("userBiz");
		System.out.println(userBiz.query());
		
		UserBiz userBiz2=(UserBiz)context.getBean("userBiz");
		System.out.println(userBiz==userBiz2);
		UserBiz userDao =(UserBiz) context.getBean("userBiz2");
		userDao.query();*/
		User user =(User) context.getBean("user");
		for (String string : user.getPhones()) {
			System.out.println(string);
		}
		
		
	}
}
